home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-19 | 3.0 KB | 119 lines | [TEXT/MPS ] |
- /*
- File: TestTimeStamp.cp
-
- Contains: Tester for the TTimeStamp class
-
- Copyright: © 1991-1994 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #ifndef __TESTTIMESTAMP__
- #include "TestTimeStamp.h"
- #endif
-
- /*******************************************************************************
- ** Constructor/Destructor
- ********************************************************************************/
-
- Constructor(TimeStamp)
- Destructor(TimeStamp)
-
- /**********************************************************************
- ** PUBLIC InitTest
- ***********************************************************************/
-
- void TTestTimeStamp::InitTest(BooleanParm, BooleanParm, int, char**)
- {
- TStandardPool* pool = GetPool();
-
- if (pool == NULL)
- {
- Printf("### ERROR: There is no global pool\n");
- return;
- }
-
- if ((fTest = new (pool) TStopwatch) == NULL)
- Printf("### ERROR: Couldn't create a new TStopWatch\n");
- }
-
- /**********************************************************************
- ** PUBLIC RunTestIteration
- ***********************************************************************/
-
- void TTestTimeStamp::RunTestIteration(BooleanParm, BooleanParm)
- {
- unsigned long time;
- TStopwatch* watch = (TStopwatch*)fTest;
-
- unsigned long tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- watch->Reset();
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- time = watch->ElapsedMicroseconds();
- Printf("INFO: 1 Tick = %u Microseconds\n", time);
-
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- watch->Reset();
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- time = watch->ElapsedMilliseconds();
- Printf("INFO: 1 Tick = %u Milliseconds\n", time);
-
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- watch->Reset();
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- time = watch->ElapsedSeconds();
- Printf("INFO: 1 Tick = %u Seconds\n", time);
-
-
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- watch->Reset();
- tick = *(unsigned long *)0x16A;
- while (*(unsigned long *)0x16a - tick < 60)
- ;
- time = watch->ElapsedMicroseconds();
- Printf("INFO: 1 Second = %u Microseconds\n", time);
-
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- watch->Reset();
- tick = *(unsigned long *)0x16A;
- while (*(unsigned long *)0x16a - tick < 60)
- ;
- time = watch->ElapsedMilliseconds();
- Printf("INFO: 1 Second = %u Milliseconds\n", time);
-
- tick = *(unsigned long *)0x16A;
- while (tick == *(unsigned long *)0x16a)
- ;
- watch->Reset();
- tick = *(unsigned long *)0x16A;
- while (*(unsigned long *)0x16a - tick < 60)
- ;
- time = watch->ElapsedSeconds();
- Printf("INFO: 1 Second = %u Seconds\n", time);
- }
-
- /**********************************************************************
- ** PUBLIC EndTest
- ***********************************************************************/
-
- void TTestTimeStamp::EndTest(BooleanParm, BooleanParm)
- {
- delete fTest;
- fTest = NULL;
- }
-